package mall.kotlin.com.myapplication;

/**
 * USER: zjw
 * DATA: 2018/11/20 0020
 * TIME: 下午 5:05
 */
public class Single {
    private volatile static Single single;

    private Single() {
    }

    public static Single getSingleInstance() {
        if (single == null) {
            synchronized (Single.class) {
                if (single == null) {
                    single = new Single();
                }
            }
        }
        return single;
    }

    public static Single getSingleInstance2() {
        return SingleHolder.singleInstance;
    }

    private static class SingleHolder {
        private static final Single singleInstance = new Single();
    }
}
